package algorithm.recursive;

import cn.hutool.core.date.StopWatch;

/**
 * @Name : algorithm.recursive.FactorialTest
 * @Description : 描述
 * Created by cyd on 2021-06-15 10:46:02
 */
public class FactorialTest {
    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        long factorial = FactorialTest.factorial(42);
        System.out.println(factorial);

        long l1 = System.currentTimeMillis();
        System.out.println(l1-l);
    }

    public static long factorial(long n) {
        if (n == 1L) {
            return 1L;
        } else {
            return (factorial(n - 1)) * n;
        }
    }
}
